package routers

import (
	"fox/controllers"
	"fox/middleware"
	"github.com/gin-gonic/gin"
)

func AdminSysRouter(router *gin.RouterGroup) {
	var (
		loginController *controllers.SysController
	)

	loginController = controllers.NewSysController()

	router.POST("/login", loginController.Login)
	router.GET("/profile", middleware.Auth(), loginController.Profile)

	return
}

func AdminUserRouter(router *gin.RouterGroup) {
	var (
		userController *controllers.UserController
	)

	userController = controllers.NewUserController()

	//测试
	router.POST("/login", userController.Login)
	//router.POST("/logout", Logout)
	//user curd
	router.POST("", userController.SaveUser)
	router.GET("", userController.GetUser)
	router.DELETE("", userController.DeleteUser)
	router.PUT("", userController.UpdateUser)
	router.GET("/paging", userController.GetUsers)

	return

}

func AdminRoleRouter(router *gin.RouterGroup) {
	var (
		roleController *controllers.RoleController
	)

	roleController = controllers.NewRoleController()

	//role curd
	router.POST("", roleController.SaveRole)
	router.GET("", roleController.GetRole)
	router.DELETE("", roleController.DeleteRole)
	router.PUT("", roleController.UpdateRole)
	router.GET("/paging", roleController.GetRoles)

	return
}

func AdminPermissionRouter(router *gin.RouterGroup) {
	var (
		permissionController *controllers.PermissionController
	)

	permissionController = controllers.NewPermissionController()

	router.POST("", permissionController.SavePermission)
	router.GET("", permissionController.GetPermission)
	router.DELETE("", permissionController.DeletePermission)
	router.PUT("", permissionController.UpdatePermission)
	router.GET("/paging", permissionController.GetPermissions)

	return
}
